package com.zytlifeservice.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * Created by MJS on 2017/4/28.
 */
@Entity
public class Verify {

    //和手机号绑定，验证时间处理，一个用户，一天，最多只能发送6条记录。即成功激活的验证码的状态。
    //以userId为主键处理。

    @Id
    @GeneratedValue
    private long id;

    private long userId;

    @NotNull(message = "手机号不能为空")
    private String mobile;

    @Size(min = 6, max = 6, message = "验证码只能为6位")
    private String verifyCode;

    private Date sendTime;

    //是否激活 10分钟内自动，且用户当前只能有一条验证信息。误差的处理时间。
    private int status;  //0-未激活 1-已激活


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Verify{" +
                "id=" + id +
                ", userId=" + userId +
                ", mobile='" + mobile + '\'' +
                ", verifyCode='" + verifyCode + '\'' +
                ", sendTime=" + sendTime +
                ", status=" + status +
                '}';
    }
}
